<template>
  <div class="dashboard-container">
    <!-- 欢迎横幅 -->
    <div class="welcome-banner">
      <div class="welcome-content">
        <div class="welcome-text">
          <h1 class="welcome-title">欢迎回来，{{ name }}！</h1>
          <p class="welcome-subtitle">今天是美好的一天，让我们开始工作吧</p>
        </div>
        <div class="welcome-icon">
          <div class="icon-circle">
            <svg-icon icon-class="dashboard" />
          </div>
        </div>
      </div>
    </div>

    <!-- 统计卡片区域 -->
    <div class="stats-section">
      <div class="stats-grid">
        <div class="stat-card">
          <div class="stat-icon">
            <svg-icon icon-class="user" />
          </div>
          <div class="stat-content">
            <h3 class="stat-number">1,234</h3>
            <p class="stat-label">总用户数</p>
          </div>
        </div>

        <div class="stat-card">
          <div class="stat-icon">
            <svg-icon icon-class="chart" />
          </div>
          <div class="stat-content">
            <h3 class="stat-number">89%</h3>
            <p class="stat-label">系统使用率</p>
          </div>
        </div>

        <div class="stat-card">
          <div class="stat-icon">
            <svg-icon icon-class="message" />
          </div>
          <div class="stat-content">
            <h3 class="stat-number">256</h3>
            <p class="stat-label">今日消息</p>
          </div>
        </div>

        <div class="stat-card">
          <div class="stat-icon">
            <svg-icon icon-class="star" />
          </div>
          <div class="stat-content">
            <h3 class="stat-number">4.9</h3>
            <p class="stat-label">用户评分</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'Dashboard',
  computed: {
    ...mapGetters([
      'name',
      'avatar'
    ])
  }
}
</script>

<style lang="scss" scoped>
$primary: #667eea;
$primary-light: #7c8fff;
$primary-dark: #5a67d8;
$success: #48bb78;
$warning: #ed8936;
$danger: #f56565;
$info: #4299e1;

.dashboard-container {
  padding: 20px;
  background: #f5f7fa;
  min-height: calc(100vh - 50px);
}

// 欢迎横幅
.welcome-banner {
  background: linear-gradient(135deg, $primary 0%, $primary-light 100%);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);

  .welcome-content {
    display: flex;
    align-items: center;
    justify-content: space-between;

    .welcome-text {
      .welcome-title {
        color: white;
        font-size: 24px;
        font-weight: 600;
        margin: 0 0 6px;
        letter-spacing: 0.5px;
      }

      .welcome-subtitle {
        color: rgba(255, 255, 255, 0.9);
        font-size: 14px;
        margin: 0;
      }
    }

    .welcome-icon {
      .icon-circle {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid rgba(255, 255, 255, 0.3);

        .svg-icon {
          font-size: 24px;
          color: white;
        }
      }
    }
  }
}

// 统计卡片区域
.stats-section {
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;

    .stat-card {
      background: white;
      border-radius: 10px;
      padding: 20px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      transition: all 0.3s ease;
      display: flex;
      align-items: center;

      &:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
      }

      .stat-icon {
        width: 40px;
        height: 40px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 12px;
        font-size: 20px;
        color: white;

        &:nth-child(1) { background: $primary; }
        &:nth-child(2) { background: $success; }
        &:nth-child(3) { background: $warning; }
        &:nth-child(4) { background: $info; }
      }

      .stat-content {
        .stat-number {
          font-size: 20px;
          font-weight: 600;
          color: #2d3748;
          margin: 0 0 2px;
        }

        .stat-label {
          font-size: 13px;
          color: #718096;
          margin: 0;
        }
      }
    }
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    padding: 15px;
  }

  .welcome-banner {
    padding: 20px;
    margin-bottom: 20px;

    .welcome-content {
      .welcome-text {
        .welcome-title {
          font-size: 20px;
        }

        .welcome-subtitle {
          font-size: 13px;
        }
      }

      .welcome-icon .icon-circle {
        width: 45px;
        height: 45px;

        .svg-icon {
          font-size: 20px;
        }
      }
    }
  }

  .stats-section .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;

    .stat-card {
      padding: 15px;

      .stat-icon {
        width: 35px;
        height: 35px;
        font-size: 18px;
        margin-right: 10px;
      }

      .stat-content {
        .stat-number {
          font-size: 18px;
        }

        .stat-label {
          font-size: 12px;
        }
      }
    }
  }
}
</style>
